{% load i18n %}
<fieldset>
    <legend>User Profile</legend>
    <div class="fieldsetdiv">
        <form method=post id="userProfileForm" name="userProfileForm">
            <input type="hidden" value="{%if temp_user%}{{temp_user.id}}{%endif%}" id="userid" name="userid"/>
            <table cellspacing="0" class="yui-skin-sam noborder_table">
                <tbody>
                    <tr>
                        <th><label for="email">{% trans "E-mail Address" %}:</label></th>
                        <td><input type="text" id="email" value="{%if temp_user%}{{temp_user.email}}{%endif%}"
                                   name="email" size="30"/>
                            <span id="checkEmailAlert"></span>
                        </td>
                    </tr>
                    <tr>
                        <th/>
                        <td><p style="display: none;" id="email_unavailable_text">
                            {% trans "That address has already been registered by another user." %}
                        </p>
                        </td>
                    </tr>
                    <tr>
                        <th><label for="username">{% trans "Username" %}:</label></th>
                        <td><input type="text" id="username" value="{%if temp_user%}{{temp_user.username}}{%endif%}"
                                   name="username" size="30"/>
                            <span id="checkUsernameAlert"></span>
                        </td>
                    </tr>
                    <tr>
                        <th/>
                        <td><p style="display: none;" id="username_unavailable_text">
                            {% trans "That username has already been registered by another user." %}
                        </p>
                        </td>
                    </tr>
                    <tr>
                        <th><label for="firstname">{% trans "First Name" %}:</label>
                        </th>
                        <td><input type="text" id="firstname" size="30"
                                   value="{%if temp_user%}{{temp_user.firstname}}{%endif%}" name="firstname"/>
                            <span id="checkFirstNameAlert"></span></td>
                    </tr>
                    <tr>
                        <th><label for="lastname">{% trans "Last Name" %}:</label></th>
                        <td><input type="text" id="lastname" size="30"
                                   value="{%if temp_user%}{{temp_user.lastname}}{%endif%}" name="lastname"/>
                            <span id="checkLastNameAlert"/></td>
                    </tr>
                    <tr>
                        <th><label for="country">{% trans "Country" %}:</label></th>
                        <td>
                            <select id="country" name="country"/>
                            <input id="country_hidden"
                                   value="{%if temp_user and temp_user.country %}{{temp_user.country}}{% endif %}"
                                   type="hidden"/>
                        </td>
                    </tr>
                    <tr>
                        <th><label for="birthday">{% trans "Birthday" %}:</label></th>
                        <td>
                            <input name="birthday" id="birthday" type="hidden"
                                   value='{%if temp_user and temp_user.birthday %}{{temp_user.birthday|date:"Y-m-j"}}{% endif %}'>
                            <select id="year" name="year" style="margin-right:5px"/>
                            <select id="month" name="month" style="margin-right:5px"/>
                            <select id="day" name="day"/>
                        </td>
                    </tr>
                    <tr>
                        <th><label>{% trans "Gender" %}:</label></th>
                        <td>
                            <input type="radio" id="gender_Female"
                                   value="Female" name="gender"
                            {%if temp_user and temp_user.gender %}{%ifequal temp_user.gender 'F'%} checked{%endifequal%}{% endif %}/>
                            <label for="gender_Female">{% trans "Female" %}</label>
                            <input type="radio" id="gender_Male"
                                   value="Male" name="gender"
                            {%if temp_user and temp_user.gender %}{%ifequal temp_user.gender 'M'%} checked{%endifequal%}{% endif %}/>
                            <label for="gender_Male">{% trans "Male" %}</label>
                        </td>
                    </tr>
                    <tr>
                        <th/>
                        <td>
                            <input type="button" id="update_profile_btn" value="Update Profile"/>
                        </td>
                    </tr>
                </tbody>
            </table>
        </form>
    </div>
</fieldset>
<fieldset>
    <legend>OpenID</legend>
    <div class="fieldsetdiv">
        <form method=post id="userOpenIDForm" name="userOpenIDForm" action="/login/openid" target="_blank">
            <input type="hidden" value="{%if temp_user%}{{temp_user.id}}{%endif%}"  name="userid"/>
            <table cellspacing="0" class="yui-skin-sam noborder_table" id="openIDTable">
                {%for openid in temp_user.openids%}
                <tr>
                    <td>
                        <a href="{{openid}}" target="_blank" style="text-decoration:underline!important;">{{openid}}</a>
                    </td>
                    <td><a href="javascript:deleteOpenid('{{openid}}')" id="{{openid}}" name="deleteOpenID"><b>{% trans "delete" %}</b></a></td>
                </tr>
                {%endfor%}
                <tr><td><br></td></tr>
            </table>

            <table cellspacing="0" class="yui-skin-sam noborder_table">
                 <tr>
                    <th><label for="openid_identifier">OpenId</label></th>
                    <td>
                        <input type="text" name="openid_identifier" id="openid_identifier" size="30"/>
                    </td>
                </tr>
                <tr>
                    <th/>
                    <td>
                        <input type="button" value="Attach an OpenID" id="attach_open_id"/>
                    </td>
                </tr>
            </table>
        </form>
    </div>
</fieldset>
<fieldset>
    <legend>{% trans "Change Password" %}</legend>
    <div class="fieldsetdiv">
        <form method=post id="userPasswordForm" name="userPasswordForm">
            <input type="hidden" value="{%if temp_user%}{{temp_user.id}}{%endif%}"  name="userid"/>
            <table cellspacing="0" class="yui-skin-sam noborder_table">
                <tr>
                    <th><label for="password">New Password</label></th>
                    <td><input type="password" id="password" maxlength="255" name="password" size="30"/>
                        <span id="checkPasswordAlert"></span>
                        <div id="password_unavailable_text">
                            {% trans "at least 6 characters (case sensitive)" %}
                        </div>
                    </td>
                </tr>
                <tr>
                    <th><label for="password_confirm">Password confirmation</label></th>
                    <td><input type="password" id="password_confirm" maxlength="255" name="password_confirm" size="30"/>
                        <span id="checkPasswordConfirmAlert"></span>
                         <div id="password_confirm_unavailable_text" style="display:none;">
                            {% trans "Password doesn't match the confirmation" %}
                        </div>
                    </td>
                </tr>
                <tr>
                    <th/>
                    <td>
                        <input type="button" id="change_password_btn" value="Change Password"/>
                    </td>
                </tr>
            </table>
        </form>
    </div>
</fieldset>

